package com.java1412.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author java1412
 * @since 2024-01-11 11:22:46
 */
@RestController
@RefreshScope   // 配置信息修改后可以自动刷新
public class TestController {

    // 将远程仓库中foo属性的值映射到当前组件TestController属性上
    @Value("${foo}")
    private String foo;

    @RequestMapping(value = "/hi")
    public String hi() {
        return foo;
    }
}
